﻿Imports dooll.Common

Public Class frmLogin

    ' TODO: 插入代码，以使用提供的用户名和密码执行自定义的身份验证
    ' (请参见 http://go.microsoft.com/fwlink/?LinkId=35339)。 
    ' 随后自定义主体可附加到当前线程的主体，如下所示: 
    '     My.User.CurrentPrincipal = CustomPrincipal
    ' 其中 CustomPrincipal 是用于执行身份验证的 IPrincipal 实现。 
    ' 随后，My.User 将返回 CustomPrincipal 对象中封装的标识信息
    ' 如用户名、显示名等
    Private iErrCount As Integer

    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        AdminInfo = AdminManage.Login(UsernameTextBox.Text, PasswordTextBox.Text, Nothing)
        If AdminInfo Is Nothing OrElse Not AdminInfo.IsLogin Then
            MsgBox(AdminManage.ErrMessage, MsgBoxStyle.OkOnly, "提示")
            iErrCount = iErrCount + 1
            If iErrCount >= 3 Then
                MsgBox("你登录错误超过3次程序将关闭!", MsgBoxStyle.OkOnly, "提示")
                ApplicationExit()
            End If
        Else
            Console.WriteLine("系统登录成功!")

            Me.Close()
        End If
    End Sub

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
        Me.Close()
    End Sub

    Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
